<?php
/*
 * 读取商品所上传的图片，以相册的形式显示
 */
include '../include/common.inc.php';
$adminhelp=new Adminhelp();
if(!$q=$adminhelp->mcheckol()){
    header("Location:".$C['SITE_URL']."/admin/login.php");
    exit;
}
$adminhelp->mupdatesession();
unset($q);
$commoid=$_GET["commoid"]?(int)$_GET["commoid"]:0;
if(!$commoid){
    $q=$db->query("select * from attachment where commoid=0");
}else{
    $q=$db->query("select * from attachment where commoid=0 or commoid={$commoid}");
}
$pics=array();
while($row = $db->fetch_array($q)){
    if($row['isimg']==1){
        $pics[]=$row['aid'];
    }
}
?>
<tr>
<?php
foreach($pics as $v){
    echo "<td style='padding:10px;'><img src='".$C['SITE_URL']."/img.php?aid=".$v."' width=100 height=120/><p><input type=button value='复制url' onclick=\"copypic('".$C['SITE_URL']."/img.php?aid=".$v."')\"> <a href=# onclick=\"delpic('".$v."')\">删除</a></p><input type=hidden name='att[]' value='".$v."'/></td>";
}
?>
</tr>
   